package com.dearbinge.web.user.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;



@Configuration
public class WebAppConfig extends WebMvcConfigurerAdapter{

	/**
     * 将自定义拦截器作为Bean写入配置
     * @return
     */

    @Bean
    Interceptor interceptor() {
      return new Interceptor();
    }

//    @Autowired
//    private  Interceptor interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(interceptor()).addPathPatterns("/**");
    }


}